package sudoku.view;

import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JRadioButton;

import language.Messages;
import sudoku.controller.FirstActivityController;
import sudoku.controller.IController;
import sudoku.controller.ListenerGui;

/**
 * @author Vista principal para la eleccion de la interfaz
 * 
 */
public class FirstActivity extends JFrame implements IView
{
	private static final long	serialVersionUID	= 1L;
	private JRadioButton			radioGui1_;
	private JRadioButton			radioGui2_;

	public FirstActivity() {
		super(Messages.getString("FirstActivity.0"));
		setSize(500, 100);
		setLocationRelativeTo(null);
		setVisible(true);

		ButtonGroup btnG = new ButtonGroup();
		getContentPane().setLayout(null);

		radioGui1_ = new JRadioButton(Messages.getString("FirstActivity.vista1")); //$NON-NLS-1$
		radioGui1_.setBounds(38, 12, 73, 23);
		getContentPane().add(radioGui1_);
		btnG.add(radioGui1_);

		JButton btnsignIn = new JButton(
				Messages.getString("FirstActivity.ingresar")); //$NON-NLS-1$
		btnsignIn.setBounds(131, 12, 108, 50);
		getContentPane().add(btnsignIn);

		ListenerGui buttonListener = new ListenerGui();
		IController fController = new FirstActivityController();
		fController.setView(this);

		buttonListener.associate(btnsignIn, fController);

		radioGui2_ = new JRadioButton(Messages.getString("FirstActivity.vista2")); //$NON-NLS-1$
		radioGui2_.setBounds(38, 39, 73, 23);
		getContentPane().add(radioGui2_);

		// relacion logica
		btnG.add(radioGui2_);
		
		JLabel lblLenguaje = new JLabel(Messages.getString("FirstActivity.lblLenguaje")); //$NON-NLS-1$
		lblLenguaje.setBounds(401, 12, 70, 15);
		getContentPane().add(lblLenguaje);
		
		
		JComboBox comboBox = new JComboBox();
		comboBox.setBounds(439, 38, 32, 24);
		getContentPane().add(comboBox);
		
		buttonListener.associate(comboBox, fController);
	}

	/**
	 * @return true ssi se selecciono la vista 1
	 */
	public boolean isSelectedVista1()
	{
		return radioGui1_.isSelected();
	}

	/**
	 * @return true ssi se selecciono la vista 2
	 */
	public boolean isSelectedVista2()
	{
		return radioGui2_.isSelected();
	}

	@Override
	public void present(String model)
	{
		JOptionPane.showMessageDialog(null, model);

	}
}
